package com.luban.service;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;

/**
 * @Author: lijunwei
 * @Time: 2021/2/15 20:45
 */
public class UserInstantiationAwareBeanProcessor implements InstantiationAwareBeanPostProcessor {
	@Override
	public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
		System.out.println("实例化前");
		if (beanName.equals("userService")) {
			return new User();
		}
		return null;
	}
}
